package com.csxh.web.model;

public class BuyItem implements IBuyItem {

	private int id;
	private String isbn;
	private String name;
	private float price;
	private int quantity;
	private float unitWeight;
	
	
	public String getIsbn() {
		return isbn;
	}
	
	public void setIsbn(String isbn) {
		this.isbn = isbn;
	}
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public float getPrice() {
		return price;
	}
	public void setPrice(float price) {
		this.price = price;
	}
	public int getQuantity() {
		return quantity;
	}
	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}
	
	public void setUnitWeight(float unitWeight) {
		this.unitWeight = unitWeight;
	}
	
	public float getUnitWeight() {
		// TODO Auto-generated method stub
		return this.unitWeight;
	}
	public float getTotalPrice() {
		// TODO Auto-generated method stub
		return this.price*this.quantity;
	}
	public float getTotalWeight() {
		// TODO Auto-generated method stub
		return this.unitWeight*this.quantity;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		BuyItem other = (BuyItem) obj;
		if (id != other.id)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "BuyItem [id=" + id + ", isbn=" + isbn + ", name=" + name + ", price=" + price + ", quantity=" + quantity
				+ ", unitWeight=" + unitWeight + "]";
	}
	
	
}
